<template>
  <div class="wrap">
    <div class="rentWrap" :style="backgroundDiv">
      <p v-if="shopInfo.isDayRec">日推有效期至：{{shopInfo.dayRecEndTime	}}</p>
      <p v-if="!shopInfo.isDayRec">暂未购买日推</p>
      <p>今日首推：{{resGetVipRecInfo.topStatus==1?'未推广':'推广中'}}</p>
      <p>今日次推：{{resGetVipRecInfo.nextStatus==1?'未推广':'推广中'}}</p>
      <p>今日末推：{{resGetVipRecInfo.endStatus==1?'未推广':'推广中'}}</p>
    </div>
    <div class="btn1" @click="jumpBuyDay">购买日推</div>
    <div class="btn2 btn1" @click="jumpBuyOther">购买首.次.末推</div>
  </div>
</template>

<script>
import { RadioGroup } from "vant";
import { apiPlatformGetUserShopDetails,apiGetVipRecInfo } from "@/request/api"; // api接口
export default {
  name: "App",
  data() {
    return {
      backgroundDiv: {
        backgroundImage: "url(" + require("@/assets/bMyWallet.png") + ")",
        backgroundRepeat: "no-repeat",
        backgroundSize: "100% 100%",
      },
      shopInfo: "", //店铺信息
      resGetVipRecInfo:'',//首末次推情况相关
    };
  },
  mounted() {
    document.querySelector("body").setAttribute("style", "background-color:#F2F4FA");
    this.getAppUserInfo();
    this.getVipRecInfo()
  },
  methods: {
    //用户信息获取店铺押金、余额等信息
    getAppUserInfo() {
      apiPlatformGetUserShopDetails({}).then((res) => {
        this.shopInfo = res.data;
      });
    },
    //获取首末次推数据：
    getVipRecInfo() {
      apiGetVipRecInfo({}).then((res) => {
        this.resGetVipRecInfo = res.data;
        console.log('resGetVipRecInfo',this.resGetVipRecInfo)
      });
    },
    //购买日推
    jumpBuyDay(){
        this.$router.push({
        path: "/pages/bDayRecommend",
        query: {
          //传递参数
        },
      });
    },
    
  //购买首次末推
    jumpBuyOther(){
        this.$router.push({
        path: "/pages/bOtherRecommend",
        query: {
          //传递参数
        },
      });
    },
  },
  created() {},
  components: {
    [RadioGroup.name]: RadioGroup,
  },
};
</script>

<style scoped>
.rentWrap {
  width: 95%;
  margin: 0 auto;
  height: 147px;
  font-size: 16px;
  color: #ffffff;
  text-align: center;
  margin-top: 20px;
  padding-top: 10px;
}
.rentWrap p {
  padding-top: 8px;
  width: 90%;
  margin: 0 auto;
}
.btn1 {
  width: 95%;
  height: 50px;
  line-height: 50px;
  border: 1px solid #181818;
  box-shadow: 0px 5px 20px 0px rgba(24, 24, 24, 0.26);
  border-radius: 25px;
  font-size: 16px;
  font-weight: 500;
  color: #181818;
  text-align: center;
  position: absolute;
  bottom: 100px;
  left: 2.5%;
}
.btn2{
    color: #FFFFFF;
    background-color: #181818;
    bottom: 25px;
}
</style>
